<?php use_helper('I18N') ?>

<h1 class="wiki-title"><?php echo __('Edit a page') ?></h1>

<?php if (!$canView): ?>
  <p class="wiki-warning"><?php echo __('You are not allowed to access this page.') ?></p>
<?php else: ?>

  <?php if (!$revision->isLatest()): ?>
    <p class="wiki-warning"><?php echo __('You are currently editing an old revision of this page. If you save these changes, all changes made since this revision will be lost !!') ?> <?php echo link_to(__('Don\'t you want to edit the latest version of this page ?'), 'nahoWiki/edit?page=' . $page->getName()) ?></p>
  <?php endif ?>

  <form method="post" action="<?php echo url_for('nahoWiki/edit') ?>" name="edit_page" id="edit_page" class="wiki-form">

    <?php if ($canEdit): ?>
      <?php if (!$sf_user->isAuthenticated()): ?>
        <p><?php echo __('You are not authenticated. Your IP address will be stored : %ip%.', array('%ip%' => '<strong>' . $userName . '</strong>')) ?></p>
      <?php else: ?>
        <p><?php echo __('You are authenticated. Your username will be stored : %username%.', array('%username%' => '<strong>' . $userName . '</strong>')) ?></p>
      <?php endif ?>
    <?php endif ?>

    <ul>
      <?php echo $form->renderUsing('list') ?>
    </ul>

  </form>

  <?php if ($showPreview): ?>
    <p class="wiki-warning"><?php echo __('This is a preview of how your text will look like. Remember: <strong>It is not saved yet</strong> !') ?></p>
    <?php include_partial('content', array('preview' => true, 'revision' => $page->getRevision(), 'uriParams' => $uriParams)) ?>
  <?php endif ?>

<?php endif ?>
